]<template>
	<view>
		<uni-search-bar radius="100" bgColor="#ffff"></uni-search-bar>
		<view class="list">
			<view class="row" v-for="(item,index) in list" :key="index">
				<view class="products">
					<view class="imagebox" v-for="(myitem,myindex) in item.child" :key="myindex">
						<image :src="myitem.img" mode="widthFix"></image>
						<text class="fy">{{myitem.goodsname}}</text>
					</view>
				</view>
				<view class="info">
					<text space="nbsp">总计{{item.countnumber}}商品 </text>
					<text>应付金额 ￥{{item.countmoney}}</text>
				</view>
			</view>
			
		</view>
		<view class="tishi" v-if="tag">
			没有数据亲！
		</view>
	</view>
</template>

<script>
	import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue'
	import {baseUrl} from "../../utils/config.js"
	export default {
		components: {
			uniSearchBar
		},
		data(){
			return{
				list:[],
				tag:false
			}
		},
		async onLoad(){
			let token=JSON.parse(uni.getStorageSync("login")) 
			// console.log(token.uid,token.token);
			let result=await this.$http("/api/orders","get",{uid:token.uid},token.token)
			result.data.list.map(item=>{
				item.child.map(myitem=>{
					myitem.img=baseUrl+myitem.img
				})
			})
			this.list=result.data.list
			console.log(this.list);
			if(this.list==null){
				this.tag=true
			}else{
				this.tag=false
			}
		}
	}
</script>
<style>
	.row {
		margin: 10rpx 20rpx;
		/* height: 240rpx; */
		border: 1rpx solid #AAAAAA;
		border-radius: 30rpx;
	}

	.imagebox {
		float: left;
		margin: 10rpx;
		width: 600rpx;
	}

	.products {
		overflow: hidden;
	}

	image {
		width: 160rpx;
		margin-left: 10rpx;
	}

	.info {
		/* position: absolute;
		top: 180rpx;
		right: 50rpx; */
		display: flex;
		justify-content: space-between;
		font-size: 25rpx;
		/* width: 340rpx; */
		padding: 20rpx;
		text-align: right;
	}

	.info text:nth-of-type(2) {
		color: red;
	}

	.info text:nth-of-type(3) {
		font-size: 20rpx;
		color: #AAAAAA;
	}

	.tishi {
		line-height: 200rpx;
		text-align: center;
		font-size: 40rpx;
		color: #006699;
	}
	.fy{
		width: 500rpx;
	}
</style>
